package com.china.produce.jdk;

import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.Proxy;

/**
 * @ClassName
 * @Author niujie
 * @Version
 * @Description
 * @CreateTime 2022/5/22
 */
@Slf4j
public class Car implements MoveAble {
    @Override
    public void go()
    {
        log.info("car go !!!");
    }

    @Override
    public void test()
    {
       log.info("car test !!!");
    }

    public static void main(String[] args) {
        Car car = new Car();

        //proxy0 extend proxy implement interface location
        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles", "true");

        MoveAble carProxy = (MoveAble) Proxy.newProxyInstance(car.getClass().getClassLoader(), new Class[]{MoveAble.class}, new CarTimeInvocationHandler(car));

        carProxy.go();

    }
}
